<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<!-- RichFaces tag library declaration -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="../js/mainJS.js"></script>
<link rel="stylesheet" type="text/css" href="../css/cssMain.css" />
<title>Главен екран на потребител с роля "Преподавател"</title>
</head>
<body>

<f:view>
	<h:form>
		<jsp:include page="menu/menuLecturer.jsp" />
		<rich:spacer height="10" />
		<rich:panel styleClass="header">
			<h:panelGrid columns="3">
				<h:panelGrid width="300px">
					<h:outputText style="font-size:13;font-weight: bold;"
						value="Добре дошъл #{mbLecturer.resultUser.username}" />
				</h:panelGrid>
				<rich:spacer width="425" />
				<h:panelGrid width="300px">
					<h:commandLink value="Изход" style="font-size:13"
						action="#{mbLecturer.signOut}" />
				</h:panelGrid>
			</h:panelGrid>
		</rich:panel>
		<rich:panel styleClass="messages" id="lecturerMessages">
			<rich:messages errorClass="errorText" infoClass="errorText" />
		</rich:panel>
		<rich:panel styleClass="mainPanelCenter">
			<h:panelGrid id="mainGridLecturere" columns="1"
				styleClass="panelCenter">
				<rich:panel styleClass="mainPanelCenterBackGrForInnerPanel"
					header="Всички създадени от мен задания" headerClass="textCenter">
					<h:panelGrid styleClass="panelCenter" id="pnlAllTask">
						<rich:datascroller maxPages="10" fastControls="hide"
							for="tblAllTasks" renderIfSinglePage="true">
							<f:facet name="first">
								<h:outputText value="Първа" />
							</f:facet>
							<f:facet name="first_disabled">
								<h:outputText value="Първа" style="margin:10px;" />
							</f:facet>
							<f:facet name="last">
								<h:outputText value="Последна" style="margin:10px;" />
							</f:facet>
							<f:facet name="last_disabled">
								<h:outputText value="Последна" style="margin:10px;" />
							</f:facet>
							<f:facet name="previous">
								<h:outputText value="Предишна" style="margin:10px;" />
							</f:facet>
							<f:facet name="previous_disabled">
								<h:outputText value="Предишна" style="margin:10px;" />
							</f:facet>
							<f:facet name="next">
								<h:outputText value="Следваща" style="margin:10px;" />
							</f:facet>
							<f:facet name="next_disabled">
								<h:outputText value="Следваща" style="margin:10px;" />
							</f:facet>
						</rich:datascroller>
						<!-- Таблица в главния екран на преподавателя с всички качени от него задания -->
						<rich:dataTable value="#{mbLecturer.allTask}" id="tblAllTasks"
							rows="8" onRowMouseOver="this.className='dataTableRowMouseOver'"
							onRowMouseOut="this.className='dataTableRowMouseOut'"
							binding="#{mbLecturer.taskDataTableAll}" var="taskResult">
							<rich:column>
								<f:facet name="header">
									<h:outputText value="Избор" />
								</f:facet>
								<h:selectOneRadio
									valueChangeListener="#{mbLecturer.setSelectedTask}"
									onclick="dataTableSelectOneRadio(this);">
									<f:selectItem itemValue="null" />
								</h:selectOneRadio>
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="Име на заданието" />
								</f:facet>
								<h:outputText value="#{taskResult.title}" />
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="Описание" />
								</f:facet>
								<h:outputText value="#{taskResult.description}" />
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="Дата на ъплоуд" />
								</f:facet>
								<rich:calendar value="#{taskResult.startDate}"
									datePattern="#{mbLecturer.datePattern}" readonly="true"
									inputSize="10" />
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="Валидно до" />
								</f:facet>
								<rich:calendar value="#{taskResult.endDate}"
									datePattern="#{mbLecturer.datePattern}" readonly="true"
									inputSize="10" />
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="Статус" />
								</f:facet>
								<h:outputText value="#{taskResult.status}" />
							</rich:column>
						</rich:dataTable>
					</h:panelGrid>
				</rich:panel>
				<rich:spacer height="20" />
				<rich:panel styleClass="mainPanelCenterBackGrForInnerPanel"
					headerClass="textCenter"
					header="Всички входящи домашни работи по мойте задания">
					<h:panelGrid styleClass="panelCenter" id="panellAllHomeworks">
						<rich:datascroller maxPages="10" fastControls="hide"
							focus="pnlAllHomeworks" for="pnlAllHomeworks"
							renderIfSinglePage="true">
							<f:facet name="first">
								<h:outputText value="Първа" />
							</f:facet>
							<f:facet name="first_disabled">
								<h:outputText value="Първа" style="margin:10px;" />
							</f:facet>
							<f:facet name="last">
								<h:outputText value="Последна" style="margin:10px;" />
							</f:facet>
							<f:facet name="last_disabled">
								<h:outputText value="Последна" style="margin:10px;" />
							</f:facet>
							<f:facet name="previous">
								<h:outputText value="Предишна" style="margin:10px;" />
							</f:facet>
							<f:facet name="previous_disabled">
								<h:outputText value="Предишна" style="margin:10px;" />
							</f:facet>
							<f:facet name="next">
								<h:outputText value="Следваща" style="margin:10px;" />
							</f:facet>
							<f:facet name="next_disabled">
								<h:outputText value="Следваща" style="margin:10px;" />
							</f:facet>
						</rich:datascroller>
						<!-- Таблица в главния екран на преподавателя с всички получени домашни работи -->
						<rich:dataTable value="#{mbLecturer.allHomework}"
							id="pnlAllHomeworks" rows="8"
							onRowMouseOver="this.className='dataTableRowMouseOver'"
							onRowMouseOut="this.className='dataTableRowMouseOut'"
							binding="#{mbLecturer.homeworkDataTableAll}" var="resultHomework">
							<rich:column>
								<f:facet name="header">
									<h:outputText value="Избор" />
								</f:facet>
								<h:selectOneRadio
									valueChangeListener="#{mbLecturer.setSelectedHomework}"
									onclick="dataTableSelectOneRadio(this);">
									<f:selectItem itemValue="null" />
								</h:selectOneRadio>
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="Имена на студента" />
								</f:facet>
								<h:outputText
									value="#{resultHomework.student.firstName} #{resultHomework.student.thirdName}" />
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="Специалност на студента" />
								</f:facet>
								<h:outputText value="#{resultHomework.student.specialty.name}" />
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="Дата на получаване" />
								</f:facet>
								<rich:calendar value="#{resultHomework.sentDate}"
									datePattern="#{mbLecturer.datePattern}" readonly="true"
									inputSize="10" />
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="По задание" />
								</f:facet>
								<h:outputText value="#{resultHomework.task.title}" />
							</rich:column>rating
							<rich:column width="15px">
								<f:facet name="header">
									<h:outputText value="Оценка" />
								</f:facet>
								<h:inputText size="5" value="#{resultHomework.rating}"
									style="text-align:center"
									disabled="#{resultHomework.rating>=2 && resultHomework.rating<=6}" />
							</rich:column>
						</rich:dataTable>
					</h:panelGrid>
				</rich:panel>
			</h:panelGrid>
		</rich:panel>
		<rich:spacer height="5" />
		<rich:panel styleClass="footerMain">
			<jsp:include page="footer/footerMain.jsp" />
		</rich:panel>
	</h:form>
	<rich:modalPanel id="mdlPanelPreviewHomework" autosized="true"
		minHeight="150" minWidth="350">
		<f:facet name="header">
			<h:panelGroup>
				<h:outputText value="Панел за преглед на домашна работа"></h:outputText>
			</h:panelGroup>
		</f:facet>
		<f:facet name="controls">
			<h:panelGroup>
				<h:graphicImage value="../img/close.png" id="hidelink5" />
				<rich:componentControl for="mdlPanelPreviewHomework"
					attachTo="hidelink5" operation="hide" event="onclick" />
			</h:panelGroup>
		</f:facet>
		<h:form>
			<h:panelGrid>
				<h:panelGroup>
					<h:outputText value="Задание: " />
					<h:outputText value="#{mbLecturer.selectedHomework.task.title}"
						styleClass="outputTextValue" />
				</h:panelGroup>
				<rich:spacer height="20" />
				<h:panelGroup>
					<h:outputText value="Съпровождащ архив на домашната работа:" />
					<h:commandLink value="#{mbLecturer.selectedHomework.fileName}"
						action="#{mbLecturer.downloadHomework}"
						rendered="#{mbLecturer.selectedHomework.fileName!=null}" />
					<h:outputText value=" липсва" styleClass="outputTextValue"
						rendered="#{mbLecturer.selectedHomework.fileName==null}" />
				</h:panelGroup>
			</h:panelGrid>
			<rich:spacer height="30" />
			<a4j:commandButton value="Отказ"
				oncomplete="Richfaces.hideModalPanel('mdlPanelPreviewHomework')" />
		</h:form>
	</rich:modalPanel>
</f:view>
</body>
</html>